#include <iostream>
#include <climits>
using namespace std;
typedef long long LL;

int main()
{
    LL min_ans = 0, max_ans = LONG_MAX;
    LL a, b;
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        cin >> a >> b;
        max_ans = min(max_ans, a / b);
        min_ans = max(min_ans, a / (b + 1) + 1);
    }
    cout << min_ans << ' ' << max_ans << endl;
    return 0;
}